package com.study.lihan.letcode;

/**
 * @Author: lihan
 * @Date : 2022/9/5- 09
 * @DESCRIPTION: 326. 3 的幂
 * @version: 1.0
 */
public class My326 {
    public static void main(String[] args) {
        System.out.println(isPowerOfThree(27));
    }

    /**
     *如何找到终止条件：什么时候返回true
     **/
    public static boolean isPowerOfThree(int n) {
        if (n == 1)return  true;
        if ( n <=0 || n %3 !=0) return false;
       return isPowerOfThree(n/3);

    }
}
